package model.persistence.daos;

import java.util.Collection;

import model.entities.Mozo;
import model.persistence.HibernateSessionFactory;

import org.hibernate.Criteria;
import org.hibernate.Session;

public class MozoDAO extends GenericDAO
{
	public static Mozo getById(int id)
	{
		Session session = HibernateSessionFactory.getSessionFactory().openSession();
		return (Mozo)session.load(Mozo.class, id);
	}
	
	@SuppressWarnings("unchecked")
	public static Collection<Mozo> getAll()
	{
		Session session = HibernateSessionFactory.getSessionFactory().openSession();

		Criteria c = session.createCriteria(Mozo.class);
		return c.list();
	}
}
